﻿<%@ Page Language="C#" MasterPageFile="~/admin/Admin.master" AutoEventWireup="true"
    CodeFile="ManagerCategory.aspx.cs" Inherits="admin_category" Title="Untitled Page" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <title>Admin Manager</title>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderContent" runat="Server">
    <asp:GridView ID="grvCategory" runat="server" AutoGenerateColumns="False" Width="750px"
        OnRowEditing="grvCategory_RowEditing" AutoGenerateEditSButton="True" DataKeyNames="cat_id"
        OnRowCancelingEdit="grvCategory_RowCancelingEdit" OnRowUpdating="grvCategory_RowUpdating"
        EditRowStyle-Font-Bold="True" OnRowDeleting="grvCategory_RowDeleting" 
        BackColor="White" BorderColor="#CCCCCC" 
        BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" 
        GridLines="Horizontal" 
        onselectedindexchanged="grvCategory_SelectedIndexChanged">
        <Columns>
            <asp:BoundField DataField="cat_id" HeaderText="ID" ReadOnly="True" />
            <asp:TemplateField HeaderText="NAME">
                <ItemTemplate>
                    <%#Eval("cat_name") %>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtCatName" runat="server" Text='<%#Eval("cat_name")%>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="DESCRIPTION">
                <ItemTemplate>
                    <%#Eval("cat_description")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="txtCatDescription" runat="server" Text='<%#Eval("cat_description")%>' TextMode="SingleLine"></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Delete">
                <ItemTemplate>
                    <span onclick="return confirm('Are you sure to Delete the record?')">
                        <asp:LinkButton ID="linkB" runat="server" CommandName="Delete" Text="Delete" CausesValidation="False"></asp:LinkButton>
                    </span>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CommandField CausesValidation="False" ShowEditButton="True" />
        </Columns>

        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
        <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />

<EditRowStyle Font-Bold="True"></EditRowStyle>
    </asp:GridView>
    <br />
    <table style="width: 100%;">
        <tr>
            <td>
               
                <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
            </td>
            <td>
                
                <asp:TextBox ID="txtNameCategory" runat="server" Width="180px"></asp:TextBox> 
                <br />              
                <asp:RequiredFieldValidator ID="rqName" runat="server" ErrorMessage="Please enter Category name" 
                    SetFocusOnError="True" ControlToValidate="txtNameCategory"></asp:RequiredFieldValidator>
            </td>
            <td>
                <asp:Label ID="Label2" runat="server" Text="Description"></asp:Label>
            </td>
            <td style="width: 305px;">
                <asp:TextBox ID="txtDescriptionCategory" runat="server" Width="210px"></asp:TextBox>
                <br />
                <asp:RequiredFieldValidator ID="rqDes" runat="server" 
                    ErrorMessage=" Please enter Category description" 
                    SetFocusOnError="True" ControlToValidate="txtDescriptionCategory"></asp:RequiredFieldValidator>
            </td>
            <td>               
                <asp:Button ID="btnAddcategory" runat="server" Text="Add Category" 
                    onclick="btnAddcategory_Click" />
            </td>
        </tr>
    </table>
</asp:Content>

